package design_pattern.SimpleFactory;

public class Factory {
    public static Product creatProduct(String type){
        if(type.equals("A")){
            return new ProductA();
        }else if(type.equals("B")){
            return new ProductB();
        }else{
            return new ProductC();
        }
    }

    public static void main(String[] args) {
        //简单工厂：包生成对象的类包装起来，经此而已。
        //耦合高，代码改动大
        Product a = Factory.creatProduct("A");
        a.print();

    }
}
